"""
file: test_unit.py
Author: 城下秋草
Date: 2024/12/16
Desc: unittest框架自动化
"""

import unittest
from calculator import add, div

class TestCalc(unittest.TestCase):
    def test_add(self):
        self.assertEqual(add(4,3), 7)

    def test_div(self):
        self.assertEqual(div(4,2), 2)
        with self.assertRaises(ZeroDivisionError):
            div(4, 0)

if __name__ == "__main__":
    unittest.main()